package biz.ezcom.design.pattern.strategy;

/**
 * 打折策略：按条件返现金策略
 */
public class StrategyReturn implements Strategy {
	private double conditionMoney;//满足条件
	private double returnMoney;//返回金额

	public StrategyReturn(double conditionMoney, double returnMoney) {
		this.conditionMoney = conditionMoney;
		this.returnMoney = returnMoney;
	}

	@Override
	public double getResult(double cash) {
		double multiple = Math.floor(cash/conditionMoney);
		return cash - returnMoney * multiple;
	}

}
